在Debian 7中编译Subversion,Debian 7中默认使用的是Apache2.2.X所以选用Subversion 1.7,此步骤也适用于Ubuntu 12.X

从1.7开始需要serf才可以获得http支持,安装完成后可以使用/usr/local/subversion/bin/svn --version检查是否已经有http支持。

配置源

修改源到比较快的镜像

sed -i 's/us.archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list

或者

sed -i ’s/cn.archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list

更新源

apt-get update && apt-get upgrade

安装依赖包

apt-get install gcc apache2 libapr1 libapr1-dev libaprutil1 libaprutil1-dev libexpat1 libexpat1-dev libapron libapron-dev apache2-utils libserf1 libserf-dev

如果你已经安装了apache请查看是那种模式,以决定是apache2-prefork-dev还是apache2-threaded-dev

# apache2 -l

worker.c表示工作在threaded模式

apt-get install apache2-threaded-dev

prefork.c表示工作在prefork模式

apt-get install apache2-prefork-dev

构建Subversion

获取源码

wget https://archive.apache.org/dist/subversion/subversion-1.7.14.tar.gz

tar -zxvf subversion-1.7.14.tar.gz 
cd subversion-1.7.14

配置依赖

./get-deps.sh(依赖包已经安装了,这里就不执行这个及编译依赖包了)

编译和安装

./configure --prefix=/usr/local/subversion --enable-debug --with-openssl --enable-maintainer-mode --with-apr=/usr --with-apr-util=/usr --without-berkeley-db --with-serf=/usr

make && make install
ln -s /usr/local/subversion/bin/svn /usr/bin/svn

确认安装

root@us5:~/subversion-1.7.14# svn --version
svn, version 1.7.14 (r1542130)
   compiled Jan  2 2014, 22:43:19

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - handles 'http' scheme
  - handles 'https' scheme

配置Apache

a2enmod dav
a2enmod dav_fs

echo "LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so" > /etc/apache2/mods-available/dav_svn_authz.load
ln -s /etc/apache2/mods-available/dav_svn_authz.load /etc/apache2/mods-enabled/dav_svn_authz.load

echo "LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so" > /etc/apache2/mods-available/dav_svn.load
ln -s /etc/apache2/mods-available/dav_svn.load /etc/apache2/mods-enabled/dav_svn.load

rm -f /etc/apache2/mods-available/authz_svn.load
authz_svn_module必须在dav_svn_module之后,所以如果已经安装过svn将会在apache中有authz_svn.load这个将在dav_svn.load前启动所以要重命名

/etc/init.d/apache2 restart && tail -f /var/log/apache2/error.log

[ 编辑 | 历史 ]
最近由“jilili”在“2019-08-09 16:16:08”修改